/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author yzavaleta
 */
@Entity
@Table(name = "costoperacion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Costoperacion.findAll", query = "SELECT c FROM Costoperacion c"),
    @NamedQuery(name = "Costoperacion.findById", query = "SELECT c FROM Costoperacion c WHERE c.id = :id"),
    @NamedQuery(name = "Costoperacion.findByCostopreparacion", query = "SELECT c FROM Costoperacion c WHERE c.costopreparacion = :costopreparacion"),
    @NamedQuery(name = "Costoperacion.findByCostominimoproduccion", query = "SELECT c FROM Costoperacion c WHERE c.costominimoproduccion = :costominimoproduccion"),
    @NamedQuery(name = "Costoperacion.findByNocobrardesde", query = "SELECT c FROM Costoperacion c WHERE c.nocobrardesde = :nocobrardesde"),
    @NamedQuery(name = "Costoperacion.findByFecha", query = "SELECT c FROM Costoperacion c WHERE c.fecha = :fecha"),
    @NamedQuery(name = "Costoperacion.findByPorcentajesubcontrato", query = "SELECT c FROM Costoperacion c WHERE c.porcentajesubcontrato = :porcentajesubcontrato"),
    @NamedQuery(name = "Costoperacion.findByEscostofijo", query = "SELECT c FROM Costoperacion c WHERE c.escostofijo = :escostofijo"),
    @NamedQuery(name = "Costoperacion.findByCostototal", query = "SELECT c FROM Costoperacion c WHERE c.costototal = :costototal")})
public class Costoperacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "costopreparacion")
    private Double costopreparacion;
    @Column(name = "costominimoproduccion")
    private Double costominimoproduccion;
    @Column(name = "nocobrardesde")
    private Integer nocobrardesde;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "porcentajesubcontrato")
    private Short porcentajesubcontrato;
    @Size(max = 1)
    @Column(name = "escostofijo")
    private String escostofijo;
    @Column(name = "costototal")
    private Double costototal;
    @JoinColumn(name = "operacion_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Operacion operacion;
    @JoinColumn(name = "unidadesoperacion_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Unidadesoperacion unidadesoperacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "costoperacion", fetch = FetchType.LAZY)
    private List<Costoperacionhoracantidad> costoperacionhoracantidadList;

    public Costoperacion() {
    }

    public Costoperacion(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getCostopreparacion() {
        return costopreparacion;
    }

    public void setCostopreparacion(Double costopreparacion) {
        this.costopreparacion = costopreparacion;
    }

    public Double getCostominimoproduccion() {
        return costominimoproduccion;
    }

    public void setCostominimoproduccion(Double costominimoproduccion) {
        this.costominimoproduccion = costominimoproduccion;
    }

    public Integer getNocobrardesde() {
        return nocobrardesde;
    }

    public void setNocobrardesde(Integer nocobrardesde) {
        this.nocobrardesde = nocobrardesde;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Short getPorcentajesubcontrato() {
        return porcentajesubcontrato;
    }

    public void setPorcentajesubcontrato(Short porcentajesubcontrato) {
        this.porcentajesubcontrato = porcentajesubcontrato;
    }

    public String getEscostofijo() {
        return escostofijo;
    }

    public void setEscostofijo(String escostofijo) {
        this.escostofijo = escostofijo;
    }

    public Double getCostototal() {
        return costototal;
    }

    public void setCostototal(Double costototal) {
        this.costototal = costototal;
    }

    public Operacion getOperacion() {
        return operacion;
    }

    public void setOperacion(Operacion operacion) {
        this.operacion = operacion;
    }

    public Unidadesoperacion getUnidadesoperacion() {
        return unidadesoperacion;
    }

    public void setUnidadesoperacion(Unidadesoperacion unidadesoperacion) {
        this.unidadesoperacion = unidadesoperacion;
    }

    @XmlTransient
    public List<Costoperacionhoracantidad> getCostoperacionhoracantidadList() {
        return costoperacionhoracantidadList;
    }

    public void setCostoperacionhoracantidadList(List<Costoperacionhoracantidad> costoperacionhoracantidadList) {
        this.costoperacionhoracantidadList = costoperacionhoracantidadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Costoperacion)) {
            return false;
        }
        Costoperacion other = (Costoperacion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "be.Costoperacion[ id=" + id + " ]";
    }
    
}
